﻿<?php
class User extends AppModel	{

	var $actsAs = array('Acl' => array('type' => 'requester'));
	var $belongsTo = 'Group';
	
	var $virtualFields = array(
		'group_name' => 'Group.name'
	);
	
	
	var $validate = array(
		'login' => array(
			'loginRule-2' => array(
				'rule' => array('maxLength', 12),  
				'message' => 'Maximum 12 caractères'
			)  
		),
		'email' => array(
			'rule' => array('email', true),
			'message' => 'Adresse e-mail invalide'
		)
		
	);
	
	
	
	 
	function parentNode() {
		return null;
	}
	 
	function bindNode($object){
		return array(
		  'model' => 'Group',
		  'foreign_key' => $object['User']['group_id']
		);
	}
}
?>